/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gro.utilitarios;

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

public class FormatoTablaUsuario extends DefaultTableCellRenderer {

    Font normal = new Font("Times new roman", Font.PLAIN, 13);
    Font negrilla = new Font("Times new roman", Font.BOLD, 14);

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean selected, boolean focused, int row, int column) {
        setEnabled(table == null || table.isEnabled());
        table.setFont(normal);
        setBackground(Color.WHITE);
        setForeground(Color.BLACK);
        Color colorAzul = new Color(231, 230, 230);
        if (row % 2 == 0) {
            setBackground(colorAzul);
            setForeground(Color.black);
            table.setFont(normal);
        }

        
            setHorizontalAlignment(0);
        


        super.getTableCellRendererComponent(table, value, selected, focused, row, column);
        return this;
    }

    //
    private boolean isNumber(String cadena) {
        try {

            Double.parseDouble(cadena.replace(",", ""));
        } catch (NumberFormatException nfe) {
            String newCadena = cadena.replace(".", "").replace(',', '.');
            try {
                Double.parseDouble(newCadena);
            } catch (NumberFormatException nfe2) {
                return false;
            }
        }
        return true;
    }
}
